package com.zbkj.crmeb.merchant.api.controller;

import javax.servlet.http.HttpServletRequest;

import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.constants.Constants;
import com.crmeb.core.exception.CrmebException;

/**
 * @author cyz
 * @date 2021年05月19日15:27
 */
@Service
public class ApiBaseController {

    public Integer getMerId(HttpServletRequest servletRequest) {
        String merId = servletRequest.getHeader(Constants.HEADER_MERCHANT_ID);
        if (StringUtils.isBlank(merId)) {
            throw new CrmebException("商户信息丢失!");
        }
        return Integer.valueOf(merId);
    }
}
